package com.ase.redislike.common.result;

import lombok.Data;

/**
 * Created with IntelliJ IDEA.
 *
 * @Author： yuhang
 * @Date： 2021/11/9
 * @Description：返回状态
 */
public enum Status {
    /*这里是可以自己定义的，方便与前端交互即可*/
    UNKNOWN_ERROR(-1, "未知错误"),
    SUCCESS(200, "成功"),
    FAILURE(500, "失败"),

    /*这里是可以自己定义的，各种情况*/
    DATA_EXIST("数据存在"),
    DATA_MySQL_IS_NULL("MySQL数据库中没有相关数据");

    /**
     * 返回体
     */
    private int code;
    private String msg;

    Status(String msg) {
        this.msg = msg;
    }

    Status(int code, String msg) {
        this.code = code;
        this.msg = msg;
    }

    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    @Override
    public String toString() {
        return "Status{" +
                "code=" + code +
                ", msg='" + msg + '\'' +
                '}';
    }
}
